--战术电台 --目标选择
local zhanshudiantai_active = fk.CreateSkill {
    name = "mcdh_zhanshudiantai_active"
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

zhanshudiantai_active:addEffect('active',{
    card_num = 0,
    card_filter = Util.FalseFunc,
    min_target_num = 1,
    target_filter = function(self, player,to_select, selected)
        local room = Fk:currentRoom()
        local n = to_select.hp
        local card = Fk:cloneCard(self.card_name)
        card:addSubcards(self.card_sub)
        for _, p in ipairs(selected) do
            n = n + p.hp
        end
        return n <= player:getMark("mcdh_zhanshudiantai") and
        player:canUseTo(card, to_select,{bypass_distances = true,bypass_times = true})
    end,
    feasible = function(self,player, selected, selected_cards)
        if #selected_cards ~= 0 or #selected == 0 then return false end
        local n = 0
        for _, p in ipairs(selected) do
            n = n + p.hp
        end
        return n <= player:getMark("mcdh_zhanshudiantai")
    end,
})

return zhanshudiantai_active